#!/usr/bin/env bash

APP_NAME=hyperway
APP_VERSION=`date +%Y%m%d""%H%M%S`

# 架构: --platform linux/arm,linux/arm64,linux/amd64
OS=linux
GOARCH=arm64
PLATFORM=${OS}/${GOARCH}

REGISTRY_ADDR=domain
REGISTRY_ORG=${REGISTRY_ADDR}/org

# Docker镜像
IMAGE_NAME=${APP_NAME}_${OS}_${GOARCH}:${APP_VERSION}

DOCKER_IMAGE_URL=${REGISTRY_ADDR}/${REGISTRY_ORG}/${IMAGE_NAME}

echo ">>> BUILD DOCKER ... ${IMAGE_NAME}"
# 禁用缓存: --no-cache
docker build -f Dockerfile --platform "${PLATFORM}" -t "${IMAGE_NAME}" .

docker push "${DOCKER_IMAGE_URL}"